<template>
  <div>
    <td>科室</td>
    <td>
      <select v-model="date.kid">
        <option :value="0">请选择</option>
        <option v-for="a in date1.list" :value="a.kid">
          {{ a.kname }}
        </option>
      </select>
    </td>
    <td>病房号</td>
    <td><input type="text" v-model="date.bname" /></td>
    <td><input type="button" value="查询" @click="list" /></td>
    <table class="table table-bordered">
      <tbody>
        <tr>
          <td>序号</td>
          <td>病房号</td>
          <td>所属科室</td>
          <td>床位总数量</td>
          <td>状态</td>
          <td>空闲床数量</td>
          <td>创建日期</td>
        </tr>
        <tr v-for="a in info.list">
          <td>{{ a.bid }}</td>
          <td>{{ a.bname }}</td>
          <td>{{ a.kname }}</td>
          <td>{{ a.bnum }}</td>
          <td>{{ a.kname == 1 ? "启用" : "维修" }}</td>
          <td>{{ a.bnums }}</td>
          <td>{{ moment(a.btime).format("YYYY-MM-DD HH:mm:ss") }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup lang="ts">
import axios from "axios";
import { reactive, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import moment from "moment";
const route = useRoute();
const router = useRouter();
let info: any = reactive({
  list: [],
});
let date: any = reactive({
  kid: 0,
  bname: "",
});
onMounted(() => {
  Find();
  list();
});
const list = () => {
  axios({
    url: "/api/Bingfang/GetBingfang",
    method: "get",
    params: date,
  }).then((res) => {
    console.log(res);
    info.list = res.data;
  });
};
let date1: any = reactive({
  list: [],
});

const Find = () => {
  axios({
    url: "/api/Yesheng/Find",
    method: "get",
  }).then((res) => {
    console.log(res);
    date1.list = res.data;
  });
};
</script>

<style scoped></style>
